function scrollLeftByPace(v, target) {
    scrollSmooth(v, (d) => {
        target.scrollLeft = (target.scrollLeft + d) >= 0 ? target.scrollLeft + d : 0;
    })
}
/*NOTE  为了让scroll滑动的效果更加丝滑，所以外部同步的动作通过拆分来执行，拆分每一步伟一个像素 */
function scrollSmooth(scrollLength, scrollEvent) {
    let pace = scrollLength / Math.abs(scrollLength);
    for (let i = 0; i < Math.abs(scrollLength); i++) {
        scrollEvent(pace);
    }
}
export default scrollLeftByPace;